/**
 * Created by fkjslee on 2018/1/2.
 */
 var url = "http://118.24.11.68:8080";
// var url = "http://172.24.8.233:8080";

 function clickBtnReturn() {
     window.location.href= url + "/return/return.html" +
         "?account=" + GetQueryString("account");
 }

 function clickBtnCheck() {
    var request = new XMLHttpRequest();
    var data = "account=" + GetQueryString("account");
    request.open("POST", url + "/getOnePatient?" + data);
    request.send();
    request.onreadystatechange = function () {
        if(request.readyState === 4) {
            if(request.status === 200) {
                if(request.responseText === "-1") {
                    alert("无人在队列");
                } else {
                    var text = JSON.parse(request.responseText);
                    window.location.href= url + "/doctorSystem/doctorSystem.html" +
                    "?account=" + GetQueryString("account") + "&patientID=" + request.responseText;
                }
            }
        }
    }
 }

 /**
  * @return {null}
  */
 function GetQueryString(name) {
     var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if (r !== null)return unescape(r[2]);
     return null;
 }